<include file="Public:header"/>
<script type="text/javascript" src="__WEBPUBLIC__/Admin/laydate/laydate.js"></script>
<!--主页面-->
<div id="main-content" class="content">
    <ul class="breadcrumb">
        <li><a href="/">首页</a></li>
        <li class="active"><a href="">文章管理</a></li>
        <li class="active">图文列表</li>
    </ul>

    <div class="page-header page-header1 clearfix">
        <h3>文章管理</h3>
        <ul class="nav nav-tabs">    
            <li class="active">
                <a href="{:U('Article/articleList')}">图文列表</a>
            </li>
            <li>
                <a href="{:U('Article/addArticle')}">添加文章</a>
            </li>
        </ul>
    </div>
    <div class="search-content">
        <form action="{:U('Article/articleList')}" method="post"class="search-form form-inline" role="form">
            <div class="form-group">
                <label class="sr-only" for="title">文章标题</label>
                <input class="earch-input form-control" id="title" type="text" name="title" value="{$request.title}" placeholder="文章标题"/>　
            </div>
            <input placeholder="请输入开始日期" name="start_time" value="{$start_time}" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" style="width: 180px;height:34px;border-radius:5px">&nbsp;&nbsp;
            <input placeholder="请输入结束日期" name="end_time" value="{$end_time}" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" style="width: 180px;height:34px;border-radius:5px">
            <style>
                #laydate_ys{
                    overflow: hidden;!important;
                }
                .laydate_body .laydate_bottom{
                    height: 40px;!important;
                }
            </style>
            <button type="submit" class="btn derive">查询</button>　
        </form>
    </div>
    <div class="content-box-table">
        <form action="{:U('Article/delArticle')}" method="post" class="batch-form">
            <table class="table table-striped table-framed table-hover">
                <thead>
                    <tr>
                        <th width="4%">
                            <input class="check-all" type="checkbox" />
                        </th>
                        <th>浏览量</th>
                        <th>显示顺序</th>
                        <th>文章标题</th>
                        <th>发布时间</th>
                        <th width="10%">操作</th>
                    </tr>
                </thead>
                <tbody class="tbody">
                    <if condition="empty($list)">
                        <tr style="font-size:14px;text-align: center;"><td colspan="20">暂无数据</td></tr>
                    </if>
                    <volist name="list" id="v">
                        <tr>
                            <td><input type="checkbox" value="{$v['art_id']}" name="art_id[]"/></td>
                            <td>{$v['click_num']}</td>
                            <td><input type="text" name="sort" value="{$v['sort']}" data-id="{$v['art_id']}"></td>
                            <td>{$v['title']}</td>
                            <td>{$v['ctime']|date="Y-m-d H:i:s",###}</td>
                            <td>
                                <eq name="v['status']" value="0">
                                    <a title="显示" class="modify" style="cursor: pointer" onclick="up({$v['art_id']},1)">
                                        <span class="icon glyphicon glyphicon-arrow-up"></span>
                                    </a>&nbsp;
                                </eq>
                                <eq name="v['status']" value="1">
                                    <a title="不显示" class="modify" style="cursor: pointer" onclick="up({$v['art_id']},0)">
                                        <span class="icon glyphicon glyphicon-arrow-down"></span>
                                    </a>&nbsp;
                                </eq>
                                <a href="{:U('Article/editArticle',array('art_id'=>$v['art_id']))}" title="编辑" class="modify">
                                   <span class="icon glyphicon glyphicon-pencil"></span>
                                </a>&nbsp;
                                <a href="#" title="删除" class="delete-delete">
                                    <span class="icon glyphicon glyphicon-remove"></span>
                                </a><input type="hidden" value="{:U('Article/delArticle',array('art_id'=>$v['art_id']))}">
                            </td>
                        </tr>
                    </volist>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="20">
                            <div class="fr">
                                {$page}
                            </div>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </form>
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function(){
        //排序修改
        $("input[name='sort']").each(function(){
            var id = $(this).attr('data-id');
            var num = $(this).val();
            $(this).blur(function(){
                var sort = $(this).val();
                if(sort!=num){
                    $.post("{:U('Article/ajaxUpArticle')}",{art_id:id,sort:sort},function(){},'json');
                }
            });
        });
    });
    /**文章内容显示与否*/
    function up(id,status){
        if(confirm("确认操作？")){
            var url = "{:U('Article/ajaxStatus')}";
            $.post(url,{'id':id,'status':status},function(data){
                if(data.status==1){
                    alert("修改成功");
                    window.location.reload();
                }else{
                    alert("修改失败");
                }
            });
        }
    }
</script>
<include file="Public:footer"/>
